class Git:
    def __init__(self):
        self.working_directory = []
        self.staging_area = []
        self.local_repository = []

    def add(self, file):
        """将文件添加到暂存区"""
        if file in self.working_directory:
            self.staging_area.append(file)
            print(f"文件 '{file}' 已添加到暂存区")
        else:
            print(f"文件 '{file}' 不存在于工作区")

    def commit(self, message):
        """将暂存区的文件提交到本地仓库"""
        if self.staging_area:
            self.local_repository.append({
                "files": self.staging_area.copy(),
                "message": message
            })
            self.staging_area.clear()
            print(f"提交成功: {message}")
        else:
            print("暂存区为空，无法提交")

    def status(self):
        """查看当前状态"""
        print("\n=== 当前状态 ===")
        print("工作区文件:", self.working_directory)
        print("暂存区文件:", self.staging_area)
        print("本地仓库提交:", self.local_repository)
        print("================\n")

    def push(self):
        """模拟推送到远程仓库"""
        if self.local_repository:
            print("已将本地提交推送到远程仓库")
        else:
            print("本地仓库为空，无法推送")


def main():
    git = Git()
    git.working_directory = ["file1.txt", "file2.txt", "file3.txt"]  # 模拟工作区文件

    print("欢迎使用模拟 Git 系统！")
    while True:
        print("\n可用命令: status, add <file>, commit <message>, push, exit")
        command = input("请输入命令: ").strip()

        if command == "status":
            git.status()
        elif command.startswith("add "):
            _, file = command.split(" ", 1)
            git.add(file)
        elif command.startswith("commit "):
            _, message = command.split(" ", 1)
            git.commit(message)
        elif command == "push":
            git.push()
        elif command == "exit":
            print("退出 Git 系统。")
            break
        else:
            print("无效命令，请重试！")


if __name__ == "__main__":
    main()